package com.steak.concurrent.CompletableFuture.api;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 刘牌
 * @Title:
 * @date 2022/3/2714:18
 */
public class SimpleTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
//        CompletableFuture.supplyAsync(() -> {
//            System.out.println("step1");
//            return 100;
//        }).thenApplyAsync(s -> {
//            System.out.println("step2 "+s);
//            return s;
//        }).whenCompleteAsync((s,th) -> {
//            System.out.println("step "+s + " th "+th);
//        });

//        CompletableFuture.supplyAsync(() -> {
//            System.out.println("step1");
//            return 100;
//        }).thenApplyAsync(s -> {
//            System.out.println("step2 "+s);
//            return s;
//        }).thenAcceptAsync((a) -> {
//            System.out.println("then "+a);
//        });

//        CompletableFuture.supplyAsync(() -> {
//            System.out.println("step1");
//           return 123;
//        }).thenAcceptAsync((a) -> {
//            System.out.println(a);
//        });

//        CompletableFuture<Void> voidCompletableFuture = CompletableFuture.runAsync(() -> {
//            System.out.println("123");
//        });
//
//        System.out.println(voidCompletableFuture.get());
    }
}
